﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrganizeAdd.aspx.cs" Inherits="FPC.Offer.UI.ManagerOrganize.OrganizeAdd" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="..//favicon.ico">
    <link rel="Shortcut Icon" href="..//favicon.ico" />
    <link href="../H-ui/static/h-ui/css/H-ui.min.css" rel="stylesheet" />
    <link href="../H-ui/static/h-ui.admin/css/H-ui.admin.css" rel="stylesheet" />
    <link href="../H-ui/Lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" />
    <link href="../H-ui/static/h-ui.admin/skin/default/skin.css" rel="stylesheet" />
    <link href="../H-ui/static/h-ui.admin/css/style.css" rel="stylesheet" />
    <link href="../H-ui/Lib/layer/2.4/skin/layer.css" rel="stylesheet" />
    <title>添加用户 - H-ui.admin v3.0</title>
    <meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
    <meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
  <article class="page-container">
        <form  method="post" class="form form-horizontal" id="form-member-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>部门名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="deptname" name="username">
                </div>
            </div>
             <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">所在派出所：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <span class="select-box">
                        <select class="select" id="Organize" size="1" name="city">
                            <option value="0" selected>请选择派出所</option>
                        </select>
                    </span>
                </div>
             </div>

             <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">选择负责人：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <span class="select-box">
                        <select class="select" id="manager" size="1" name="city">
                            <option value="0" selected>委派负责人</option>
                        </select>
                    </span>
                </div>
             </div>

        <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" onclick="addtoTable()">
                </div>
            </div>
        </form>
    </article>

    <!--_footer 作为公共模版分离出去-->
    <script src="../H-ui/Lib/jquery/1.9.1/jquery.min.js"></script>
    <script src="../H-ui/Lib/layer/2.4/layer.js"></script>
    <script src="../H-ui/static/h-ui/js/H-ui.js"></script>
    <script src="../H-ui/static/h-ui.admin/js/H-ui.admin.js"></script>
    <!--/_footer 作为公共模版分离出去-->
    <!--请在下方写此页面业务相关的脚本-->
    <script src="../H-ui/Lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script src="../H-ui/Lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script src="../H-ui/Lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript">
        /*页面加载同时把下拉框的值附上*/
        $(function () {
            $.ajax({
                url: "../GeneralProcessor/MangerEmp/EmpManager.ashx",
                type: "post",
                data: {
                    Actioon: "<%=FPC.Offer.Common.EnumAction.Select %>",
                    name: "下拉"
                },
                success: function (n) {
                    var data = JSON.parse(n)
                    var manager = [];
                    var Organize = [];           
                    //添加公安局
                    $(data.lst3).each(function (i, item) {
                        Organize.push("<option value=" + item.OrganizeId + " selected>" + item.OrganizeName + "</option>");
                    })
                    $("#Organize").append(Organize)
                    //公安局默认显示第一条
                    var Organizeselected = document.getElementById("Organize")
                    Organizeselected.selectedIndex = 0;

                    //添加负责人
                    $(data.list4).each(function (i, item) {
                        manager.push("<option value=" + item.AlarmId + " selected>" + item.UserName + "</option>");
                    })
                    $("#manager").append(manager)
                    //负责人默认显示第一条
                    var managerselected = document.getElementById("manager")
                    managerselected.selectedIndex = 0;
                }
            })
        })
        function addtoTable()
        {
            var deptname = $("#deptname").val();
            if (deptname == "")
            {
                layer.alert("部门名称不能为空！")
            }
            var Organize = $("#Organize").val();
            var manager = $("#manager").val();
            $.ajax({
                url: "../GeneralProcessor/MangerOrganize/OrginzeManger.ashx",
                type: "post",
                dataType: "json",
                data: {
                    Actioon: "<%=FPC.Offer.Common.EnumAction.Add %>",
                    getdeptname: deptname,
                    getid: Organize,
                    getmanager: manager
                },
                success: function (n) {
                    if (n > 0) {
                       layer.alert('添加成功!')
                    }
                    else {
                      layer.alert('添加失败!')
                    }
                }
            })
        }
    </script>

</body>
</html>
